﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GtsServer.Model;
using System.Data;
using GtsServer.Common;
using GtsServer.DAL;

namespace GtsServer.Manage.Controller
{
    public class PrizeConvertUserRecordController
    {
        PrizeConvertUserRecordDAL dal = new PrizeConvertUserRecordDAL();
        public List<PrizeConvertUserRecordModel> GetList(string Stutas,string imsi,string UserAccount,string PrizeName,int pageIndex, int pageSize, out int count)
        {
            count = 0;
            List<PrizeConvertUserRecordModel> list = new List<PrizeConvertUserRecordModel>();
            string strWhere = " where 1=1 ";
            if (!string.IsNullOrEmpty(imsi))
            {
                strWhere += " and u.imsi='" + imsi + "' ";
            }
            if (!string.IsNullOrEmpty(UserAccount))
            {
                strWhere += " and u.UserAccount='" + UserAccount + "' ";
            }
            if (!string.IsNullOrEmpty(PrizeName))
            {
                strWhere += " and p.Name like '%" + PrizeName + "%' ";
            }
            if (!string.IsNullOrEmpty(Stutas))
            {
                strWhere += " and pcur.Stutas='" + Stutas + "' ";
            }
            DataSet ds = dal.GetList(pageIndex, pageSize, strWhere);
            count = Convert.ToInt32(ds.Tables[1].Rows[0][0]);
            list = IListDataSet.DataSetToIList<PrizeConvertUserRecordModel>(ds, 0).ToList();
            return list;
        }
    }
}
